<template>
	<!-- 订单列表 -->
	<view
		class="order-list-wrapper"
	>
		<MyNavbar title="订单列表"/>
		<u-tabs 
			:list="tabList" :current="currentTabIndex" @click="clickTab" 
			:itemStyle="{width:'150rpx', height:'44px'}" style="background-color: #FFFFFF;">
		</u-tabs>
		
		<u-list
			style="padding: 24rpx;"
		>
			<u-list-item
				v-for="(item,index) in list"
				:key="index"
			>
				<OrderItem 
					:orderData="item"
					style="margin-bottom: 24rpx;"
				/>
			</u-list-item>
		</u-list>
		
		
		<u-loadmore status="nomore" />
	</view>
</template>

<script>
	import OrderItem from "@/components/order/OrderItem.vue"
	
	export default {
		components: {
			OrderItem,
		},
		data() {
			return {
				//顶部标签栏数据
				tabList: [
					{name: '全部'},
					{name: '待付款'},
					{name: '待消费'},
					{name: '待收货'},
					{name: '待评价'},
				],
				// 当前tab索引
				currentTabIndex: 1,
				// 列表数据
				list: [],
				pageSet: {
					page: 1,
					pageSize: 20
				},
			}
		},
		onLoad() {
			this.findList();
		},
		methods: {
			// 获取订单列表
			findList(){
				let form = {
					...this.pageSet
				};
				this.$api.app.order.orderList(form).then(({data})=>{
					let records = data.records;
					this.list = records;
				});
			},
			// 点击切换标签
			clickTab(index, item){
				this.$utils.showToast('开发中开发中...');
			},
		}
	}
</script>

<style scoped>
	.order-list-wrapper{
		padding-bottom: 50rpx;
	}
</style>
